<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'user.label', default: 'User')}" />
        <title>Register</title>
    </head>
    <body>
        <div class="body col_12 col">
            <h1>Registrierung</h1>
            <!-- Messages & Errors -->
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${userInstance}">
            <div class="errors">
                <g:renderErrors bean="${userInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:hasErrors bean="${userprofileInstance}">
            <div class="errors">
                <g:renderErrors bean="${userprofileInstance}" as="list" />
            </div>
            </g:hasErrors>

		<g:form action="saveUserAndProfile">
			<fieldset class="s_column">
				<div>
					<label for="user.login">Beutzername</label>
					<g:textField name="user.login" value="${userInstance?.login}" />
				</div>
				<div>
					<label for="user.password">Passwort</label>
					<g:passwordField name="user.password" />
					<g:hiddenField name="user.role" value="user" />
					<!-- TODO: remove hidden field - security issue -->
				</div>
				<div>
					<label for="userprofile.firstName">Vorname</label>
					<g:textField name="userprofile.firstName"
						value="${userprofileInstance?.firstName}" />
				</div>
				<div>
					<label for="userprofile.lastName">Nachname</label>
					<g:textField name="userprofile.lastName"
						value="${userprofileInstance?.lastName}" />
				</div>
				<div>
					<label for="userprofile.dateOfBirth">Geburtsdatum</label>
					<g:datePicker name="userprofile.dateOfBirth" 
						value="${userprofileInstance?.dateOfBirth}"/>
				</div>
				<div>
					<label for="userprofile.gender">Geschlecht</label>
					<g:select from="${['M', 'F']}" name="userprofile.gender"
						value="${userprofileInstance?.gender}"/>
				</div>
				<div>
					<label for="userprofile.address">Adresse</label>
					<g:textField name="userprofile.address"
						value="${userprofileInstance?.address}"/>
				</div>
				<div>
					<label for="userprofile.city">Stadt</label>
					<g:textField name="userprofile.city"
						value="${userprofileInstance?.city}"/>
				</div>
				<div>
					<label for="userprofile.state">Bundesland</label>
					<g:textField name="userprofile.state"
						value="${userprofileInstance?.state}"/>
				</div>
				<div>
					<label for="userprofile.zipcode">Postleitzahl</label>
					<g:textField name="userprofile.zipcode"
						value="${userprofileInstance?.zipcode}"/>
				</div>
				<div>
					<label for="userprofile.email">E-mail</label>
					<g:textField name="userprofile.email"
						value="${userprofileInstance?.email}"/>
				</div>
				<g:submitButton name="Registrieren!" />
			</fieldset>
		</g:form>
	</div>
    </body>
</html>
